package com.aqie.easy.tree;

import com.aqie.easy.structure.Node;

import java.util.ArrayList;
import java.util.List;

/**
 * 590. N叉树的后序遍历
 * 左 -> 右 -> 根
 */
public class NTreePostorder {
    List<Integer> list = new ArrayList<>();
    public List<Integer> postorder(Node root) {
        if (root == null) return list;
        for (Node item : root.children){
            postorder(item);
        }
        list.add(root.val);
        return list;
    }
}
